package com.ruoyi.common.core.domain.model;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

@Data
public class BasePageModel extends BaseModel {

    @ApiModelProperty(value = "页码")
    @Min(value = 1, message = "页码不能小于1")
    protected int pageNo = 1;
    @ApiModelProperty(value = "每页数量")
    @Min(value = 1, message = "每页数量不能小于1")
    @Max(value = 100, message = "每页数量不能大于100")
    protected int pageSize = 20;


    public IPage toPage() {
        return new Page<>(pageNo, pageSize);
    }
}
